package com.xiyu.service.repository.customer.pool;

import com.xiyu.service.model.customer.pool.CustomerPoolMaxLimitPost;
import com.xiyu.service.model.customer.pool.CustomerPoolMaxLimitPostTable;
import org.babyfish.jimmer.spring.repository.JRepository;

import java.util.List;

public interface CustomerPoolMaxLimitPostRepository extends JRepository<CustomerPoolMaxLimitPost, Long> {
    CustomerPoolMaxLimitPostTable customerPoolMaxLimitPostTable = CustomerPoolMaxLimitPostTable.$;

    default void detailByLimitAndPost(Long limitId, List<Long> postIds){
        sql().createDelete(customerPoolMaxLimitPostTable)
                .where(customerPoolMaxLimitPostTable.id().eq(limitId))
                .whereIf(postIds != null, () -> customerPoolMaxLimitPostTable.postId().notIn(postIds))
                .execute();
    }

}